<template>
  <div>
      <el-drawer custom-class="wxkj-drawer"
            title="反馈面试结果"
            :before-close="drawerClose"
            :visible.sync="drawerShow" size="500">
            <div class="drawer-content">
                <el-form ref="form" label-width="120px">
                    <el-form-item label="面试结果：" >
                        <el-radio v-model="form.viewResult" label="0">通过</el-radio>
                        <el-radio v-model="form.viewResult" label="1">不通过</el-radio>
                    </el-form-item>
                    
                    <!-- <el-form-item label="意见及建议：" >
                        <el-input  type="textarea" v-model="form.resRemark" placeholder="请填写"></el-input>
                    </el-form-item> -->
                    <el-form-item class="fr">
                        <el-button  @click="drawerClose">取消</el-button>
                        <el-button type="primary" @click="submitForm" :loading="submitLoading">确定</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </el-drawer>
  </div>
</template>

<script>
import { editInterView,editState} from "@/api/personnel";
export default {
  data() {
    return {
        drawerShow: false,
        submitLoading: false,
        form:{
            viewResult: '0',
            resRemark: '',
            isResult: true
        }
    };
  },
// 方法
  methods: {
      // 显示
      show(id,userId,dataId) {
        this.form.id = id;
        this.form.userId = userId;
        this.dataId = dataId;
        this.drawerShow = true;
    },
    submitForm(){
       this.submitLoading = true;
       editInterView(this.form).then(res => {
         let state = 9;
         if(this.form.viewResult == 1){
              state = 10;
         }
         // 修改状态
              editState(
                {
                  dataId: this.dataId,
                  state: state
                }
              ).then(res => {
                this.$message({
                  message: "结果已反馈",
                  type: "success",
                });
                 this.submitLoading = false;
                this.drawerClose()
              }).catch(err => {
                this.submitLoading = false;
              })
         
       }).catch(err => {
                this.submitLoading = false;
              })
    },
    drawerClose() {
      this.$nextTick(() => {
        this.form = {
            viewResult: '0',
            resRemark: '',
            isResult: true
        }
        this.$refs.form.resetFields();
      });
      this.drawerShow = false;
      this.$emit("refresh");
    },
  },
// 生命周期 - 创建完成（可以访问当前this实例）
  created() {},
// 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
// 销毁
  destroyed() {}
};
</script>
<style lang="scss" scoped>
  
</style>